<!-- 定时任务理页面 -->
<template>
	<view>
		<u-navbar height="60" bgColor="#0081ff">
			<!-- #ifdef MP-WEIXIN -->
			<view class="u-nav-slot margin-top-xl" slot="left">
			</view>
			<!-- #endif -->
			<view slot="center" class="u-nav-slot" style="display: flex; flex-direction: column;align-items: center;">
				<view style=" font-size: 20px; color: #FFFFFF;">定时管理</view>
			</view>
		</u-navbar>

		<view class="cu-list menu card-menu margin-top xl-border" v-for="(item,index) in taskList" :key="index"
			@tap="toeditTask(item.jobId)">
			<view class="cu-item arrow">
				<view class="content flex align-center">
					<image class="round" style="width: 6vh;height: 6vh;" src="../../static/task.png"></image>
					<view class="flex flex-direction margin-left-sm">
						<text v-if="item.status == 0" class="text-blue">{{item.buttonName}}</text>
						<text v-else class="text-red">{{item.buttonName}}</text>
						<text class="text-grey text-sm">{{item.time + "  " + item.week}}</text>
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				imgUrl: this.imgUrl,
				taskList: null,
			}
		},
		onLoad: function(option) { //option为object类型，会序列化上个页面传递的参数
			this.getTaskList()
		},
		methods: {
			//获取用户的设备列表
			getTaskList() {
				this.$http.request({
					url: 'app/task/listByUserId',
					method: 'GET',
					success: (data) => {
						if (data.data && data.data.code == 0) {
							this.taskList = data.data.list
						}
					}
				})
			},
			toeditTask(jobId) {
				uni.navigateTo({
					url: 'editTask?jobId=' + jobId
				})

			},
		}
	}
</script>

<style>

</style>
